
public class Student {

	private String name; 
	private double totalScore; 
	private int numberOfQuizzes;
	private String quizlist = "";


	public Student(double score, String name) {

		this.name = name;
	}

	public Student (String name, double score) throws IllegalArgumentException {

		if (name == null || name.length() == 0)
			throw new IllegalArgumentException("String is empty.");

		this.name = name;
	}



	public Student (String name, double totalScore, int numberOfQuizzes) throws IllegalArgumentException {

		if (name == null || name.length() == 0)
			throw new IllegalArgumentException("Error: String is empty.");

		this.name = name;
		this.totalScore = totalScore;
		this.numberOfQuizzes = numberOfQuizzes;

	}

	public String toString() {
		return "Name: " + this.name + ", " + this.quizlist;
	}

	public Student(String name) {
		this.name = name;
	}

	public boolean equals(Object other) {
		if (other instanceof Student) {
			Student otherStudent = (Student) other;
			if (otherStudent.name == this.name)
				return true;

			else
				return false;
		}
		else
			return false;
	}

	public Student (Student s1) {
		name = s1.name;
		totalScore = s1.totalScore;
	}

	public String getName() {
		return this.name;
	}

	public double getAverage() throws UnsupportedOperationException {
		if (this.numberOfQuizzes <= 0)
			throw new UnsupportedOperationException("There is no quizzes have been taken.");
		
		return this.totalScore / this.numberOfQuizzes;
	}

	public double getTotalScore() {
		return this.totalScore;
	}

	public void addQuiz(double score) throws IllegalArgumentException {
		if (score < 0)
			throw new IllegalArgumentException("Error: wrong score.");

		this.numberOfQuizzes++;
		this.totalScore += score;
		this.quizlist += " Quiez #" + numberOfQuizzes + ": " + score + ',';
	}


}
